package com.neo.web;

import com.neo.entity.User;
import com.neo.service.*;
import com.neo.service.statistics.DjsStatisticsService;
import com.neo.util.DjsStringUtil;
import com.neo.util.ReadFromFile;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartHttpServletRequest;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Controller
public class DjsStatisticsController {

	@Autowired
	private DjsStatisticsService djsStatisticsService;
	
    protected static Logger logger= LoggerFactory.getLogger(DjsStatisticsController.class);

	@RequestMapping("/statistics")
	@ResponseBody
	public List transfer(@RequestParam(value = "type", required = true, defaultValue = "") int type,
			@RequestParam(value = "date", required = true, defaultValue = "") String date) throws Exception {

		List<Map<String, Object>> res = djsStatisticsService.query(date);

		return res;
	}
	@RequestMapping("/statistics/list")
	public String list(Model model) {
		return "statistics/list";
	}
}
